<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Building Module</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Building Module' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">building</a></li><li><a href="index.html#1">Chapter 1: Architecture</a></li><li><b>Building Module</b></li></ul></div>
<p class="purpose">Setting up the use of this module.</p>

<ul class="toc"><li><a href="1-bm.html#SP1">&#167;1. Introduction</a></li><li><a href="1-bm.html#SP2">&#167;2. Setting up the memory manager</a></li><li><a href="1-bm.html#SP3">&#167;3. The beginning</a></li><li><a href="1-bm.html#SP4">&#167;4. Initialising</a></li><li><a href="1-bm.html#SP5">&#167;5. The end</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Introduction.</b></p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">BUILDING_MODULE</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Setting up the memory manager.</b>We need to itemise the structures we'll want to allocate:
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">inter_name_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">inter_name_generator_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">package_request_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">hierarchy_location_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">hierarchy_attachment_point_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">module_request_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">submodule_identity_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">submodule_request_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">inter_schema_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">inter_schema_node_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">inter_schema_token_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">schema_parsing_error_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">I6_annotation_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">I6_annotation_term_CLASS</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">hierarchy_location</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">hierarchy_attachment_point</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">package_request</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">module_request</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">submodule_identity</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">submodule_request</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_schema</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_schema_node</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_schema_token</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">schema_parsing_error</span><span class="plain-syntax">)</span>

<span class="identifier-syntax">DECLARE_CLASS_ALLOCATED_IN_ARRAYS</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_name</span><span class="plain-syntax">, </span><span class="constant-syntax">1000</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS_ALLOCATED_IN_ARRAYS</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_name_generator</span><span class="plain-syntax">, </span><span class="constant-syntax">1000</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS_ALLOCATED_IN_ARRAYS</span><span class="plain-syntax">(</span><span class="reserved-syntax">I6_annotation</span><span class="plain-syntax">, </span><span class="constant-syntax">100</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS_ALLOCATED_IN_ARRAYS</span><span class="plain-syntax">(</span><span class="reserved-syntax">I6_annotation_term</span><span class="plain-syntax">, </span><span class="constant-syntax">100</span><span class="plain-syntax">)</span>

<span class="plain-syntax">#</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">CORE_MODULE</span>
<span class="identifier-syntax">MAKE_ANNOTATION_FUNCTIONS</span><span class="plain-syntax">(</span><span class="identifier-syntax">explicit_iname</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">endif</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. The beginning.</b></p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">SCHEMA_COMPILATION_DA</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">SCHEMA_COMPILATION_DETAILS_DA</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PACKAGING_DA</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">BuildingModule::start</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-bm.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Register this module's stream writers</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-bm.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">Register this module's debugging log aspects</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-bm.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Register this module's debugging log writers</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Register this module's stream writers</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Writers::register_writer</span><span class="plain-syntax">(</span><span class="character-syntax">'n'</span><span class="plain-syntax">, &amp;</span><a href="1-in.html#SP4" class="function-link"><span class="function-syntax">InterNames::writer</span></a><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-bm.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Register this module's debugging log aspects</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Log::declare_aspect</span><span class="plain-syntax">(</span><span class="constant-syntax">SCHEMA_COMPILATION_DA</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"schema compilation"</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Log::declare_aspect</span><span class="plain-syntax">(</span><span class="constant-syntax">SCHEMA_COMPILATION_DETAILS_DA</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"schema compilation details"</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Log::declare_aspect</span><span class="plain-syntax">(</span><span class="constant-syntax">PACKAGING_DA</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"packaging"</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-bm.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Register this module's debugging log writers</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Writers::register_logger</span><span class="plain-syntax">(</span><span class="character-syntax">'1'</span><span class="plain-syntax">, </span><a href="2-is.html#SP17" class="function-link"><span class="function-syntax">InterSchemas::log</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Writers::register_logger</span><span class="plain-syntax">(</span><span class="character-syntax">'X'</span><span class="plain-syntax">, </span><a href="1-pck.html#SP3" class="function-link"><span class="function-syntax">Packaging::log</span></a><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-bm.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Initialising.</b>The following is a component part of the <span class="extract"><span class="extract-syntax">inter_tree</span></span> structure, and is comprised
of four subcomponents of its own. That makes a lot of working data, but none of
it changes the meaning of an Inter tree: it exists as workspace needed by the
functions in this module for constructing trees.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">building_site</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_structure_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">strdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_hierarchy_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">shdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_packaging_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">spdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_production_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">sprdata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_primitives_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">spridata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">site_origins_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">soridata</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">building_site</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">BuildingModule::clear_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="1-ls.html#SP2" class="function-link"><span class="function-syntax">LargeScale::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="1-hl.html#SP20" class="function-link"><span class="function-syntax">HierarchyLocations::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-prd.html#SP2" class="function-link"><span class="function-syntax">Produce::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="1-pck.html#SP17" class="function-link"><span class="function-syntax">Packaging::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="1-ip.html#SP12" class="function-link"><span class="function-syntax">Primitives::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="1-org.html#SP1" class="function-link"><span class="function-syntax">Origins::clear_site_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure building_site is accessed in 1/ls, 1/ip, 1/org, 1/hl, 1/pck, 3/prd.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. The end.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">BuildingModule::end</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="P-wtmd.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresscurrentchapter">1</li><li class="progresscurrent">bm</li><li class="progresssection"><a href="1-ls.html">ls</a></li><li class="progresssection"><a href="1-ip.html">ip</a></li><li class="progresssection"><a href="1-org.html">org</a></li><li class="progresssection"><a href="1-hl.html">hl</a></li><li class="progresssection"><a href="1-lr.html">lr</a></li><li class="progresssection"><a href="1-trn.html">trn</a></li><li class="progresssection"><a href="1-pck.html">pck</a></li><li class="progresssection"><a href="1-in.html">in</a></li><li class="progresschapter"><a href="2-is.html">2</a></li><li class="progresschapter"><a href="3-prd.html">3</a></li><li class="progressnext"><a href="1-ls.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

